package com.ssy.lingxi.order.model.constant;

import java.util.Arrays;

/**
 * 订单转单状态枚举
 * @author xiechenhui
 * @version 2.0.0
 * @date 2022-03-16
 */
public enum OrderTransitionStatusEnum {

    /**
     * 待转单 - 1
     */
    WAIT(1, "待转单"),

    /**
     * 拒接单 - 2
     */
    REJECT(2, "拒接单"),

    /**
     * 已转单 - 3
     */
    FINISH(3, "已转单");

    OrderTransitionStatusEnum(Integer code, String name) {
        this.code = code;
        this.name = name;
    }

    private Integer code;
    private String name;

    public Integer getCode() {
        return code;
    }

    public String getName() {
        return name;
    }

    public static String getNameByCode(Integer code) {
        return Arrays.stream(OrderTransitionStatusEnum.values()).filter(e -> e.getCode().equals(code)).map(OrderTransitionStatusEnum::getName).findFirst().orElse("未知");
    }
}
